#include "emis.h"
#include "login_impl.h"
#include "serviceview_console_impl.h"
#include "managerview_console_impl.h"
void Loginimpl::login(void)
{
    cout<<"请输入你的ID：";
    int id;
    cin>>id;
    for(int i=0;i<m_vecMages.size();i++)
    {
        if(id==m_vecMages[i].get_id())
        {
            cout<<"ID已查到"<<endl;
            cout<<"请输入密码：";
            char password[20];
            cin>>password;
            if(0==strcmp(password,m_vecMages[i].get_password().c_str()))
            {
                	ServiceView_impl s1;
	                s1.menu();
                    return;
            }else 
            {
                cout<<"密码错误"<<endl;
                return;
            }
            
        }else
        {
            cout<<"ID不存在";
            return;
        }
        
    }
}
void Loginimpl::loginsup(void)
{
    cout<<"请输入你的ID：";
    int id;
    cin>>id;
    if(id==superid)
    cout<<"请输入密码：";
    char password[20];
    cin>>password;
    if( 0==strcmp(password,superpassword) && id == superid)
    {
        ManagerViewConsoleImpl p1;
	    p1.menu();
        return;
    }else 
    {
        cout<<"账号或密码错误"<<endl;
        return;
    }


        
  
}
